<template>
    <div>
        <h2>添加角色页面</h2>
        角色名称：<input type="text" v-model="name">
        <button @click="sub">添加</button>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
          name:''
        }
    },
    methods: {
      sub(){
        axios.post('http://127.0.0.1:8000/user/role/',{'name':this.name}).then(res=>{
          console.log(res.data)
          alert(res.data.msg)
          this.$router.push('/ShowRole')
        })
      }
    },
    created() {

    }
}
</script>

<style scoped>

</style>
